﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;

public partial class Route : System.Web.UI.Page
{
    Faisal_MoversEntities entites = new Faisal_MoversEntities();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var route = entites.Routes.ToList();
            GridView1.DataSource = route;
            GridView1.DataBind();
        }

    }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        Model.Route route = new Model.Route();
        route.route_distance = TextBox1.Text;
        route.route_from = TextBox2.Text;
        route.route_to = TextBox3.Text;
        entites.Routes.AddObject(route);
        entites.SaveChanges();


    }
  
}